<?php

$uname=($_GET["usrname"]);
$pwd=($_GET["password"]);
$type=($_GET["identity"]);

/* echo $uname; */

$query_str="SELECT * FROM info where usrname='{$uname}' and password=password('{$pwd}') and type='{$type}';";

/* echo "<br> {$query_str} <br>";*/

$mysqli = new mysqli("127.0.0.1", "root", "20145221", "gq");

/* check connection */
if ($mysqli->connect_errno) {
    printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}
echo "connection ok!<br> ";
/* Select queries return a resultset */
if ($result = $mysqli->multi_query($query_str)) {
    if ($result->num_rows > 0 ){
        echo "Wellcome login Mr/Mrs:{$uname} <br> ";
    } else {
        echo "login failed!!!! <br> " ;
	header("Refresh:3;url=login.html");
    }

    /* free result set */
    $result->close();
}

$mysqli->close();
?>
